#include <CSLP/CSLP.h>
/*
 * 0: black
 * 1: red
 * 2: green
 * 3: yellow
 * 4: blue
 * 5: magenta
 * 6: cyan
 * 7: white
 */
const char ch_color_dic[8] = "brgybmcw";

int main()
{
  int fg, bg, pair;

  CSLP_InitCurses(CSLP_INIT_COLORS, 0);
  CSLP_InitMainColorPairs();
  addstr("Test de couleurs :\n");
  addstr(" bb");
  for (fg = COLOR_RED; fg <= COLOR_WHITE; fg++)
  {
    CSLP_ColorText(fg);
    addch(ch_color_dic[fg]);
    addch(ch_color_dic[fg]);
  }
  addch('\n');
  for (bg = COLOR_BLACK; bg <= COLOR_WHITE; bg++)
  {
    CSLP_Color((bg == COLOR_BLACK ? COLOR_WHITE : COLOR_BLACK), bg);
    addch(ch_color_dic[bg]);
    for (fg = COLOR_BLACK; fg <= COLOR_WHITE; fg++)
    {
      CSLP_ColorText(fg);
      printw("%.2i", CSLP_GetPair(fg, bg));
    }
    CSLP_ResetColors();
    addch('\n');
  }
  for (pair = 0; pair < 64; pair++)
  {
    attr_set(0, pair, 0);
    addch('0' + pair % 10);
  }
  attr_set(0, 0, 0);
  addch('\n');
  refresh();
  getch();
  endwin();
  return 0;
}
